import { Body, Controller, Get, Post, Query, SetMetadata } from '@nestjs/common';
import { CreateRoleDto, DeleteRoleDto, FindManyRoleDto, UpdateRoleDto } from '../dto/role.dto';
import { RoleService } from './role.service';
import { ApiTags } from '@nestjs/swagger';

@ApiTags('角色管理')
@Controller('role')
@SetMetadata('require-permission', ['superAdmin'])
export class RoleController {
    constructor(private readonly roleService: RoleService) { }

    @Post("create")
    create(@Body() cd: CreateRoleDto) {
        return this.roleService.create(cd);
    }

    @Post("delete")
    delete(@Body() dd: DeleteRoleDto) {
        return this.roleService.delete(dd)
    }

    @Post("update")
    update(@Body() ud: UpdateRoleDto) {
        return this.roleService.update(ud)
    }

    @Get("findMany")
    findMany(@Query() fmd: FindManyRoleDto) {
        return this.roleService.findMany(fmd)
    }
}
